Path: blob/master/src/packages/next/pages/store/[[...page]].tsx
1492 views
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Layout } from "antd";6import Header from "components/landing/header";7import Footer from "components/landing/footer";8import Head from "components/landing/head";9import Store from "components/store";10import { StorePages } from "components/store/types";11import { Customize } from "lib/customize";12import withCustomize from "lib/with-customize";13import { capitalize } from "@cocalc/util/misc";14import Error from "next/error";1516export default function Preferences({ customize, page, pageNotFound }) {17const subpage = page[0] != null ? ` - ${capitalize(page[0])}` : "";1819return (20<Customize value={customize}>21<Head title={`Store${subpage}`} />22<Layout>23<Header page={"store"} />24{pageNotFound ? <Error statusCode={404} /> : <Store page={page} />}25<Footer />26</Layout>27</Customize>28);29}3031export async function getServerSideProps(context) {32let { page } = context.params;33if (page == null) {34page = [];35}36if (page.length > 0 && !StorePages.includes(page[0])) {37return await withCustomize({38context,39props: { pageNotFound: true, page },40});41}4243return await withCustomize({ context, props: { page } });44}454647